#ifndef AST_EXPRESSION_CAST_EXPR_H
#define AST_EXPRESSION_CAST_EXPR_H

#include "../ASTNode.h"

class UnaryExpr;
class sym ;
/*
C99 6.5.4
cast-expression:
		unary-expression
		(	type-name	)	cast-expression
*/
class CastExpr : public ASTNode
{
protected:
	CastExpr() 
		: ASTNode(ASTNode::cast_expression){}
public:
	explicit CastExpr(UnaryExpr *pUnaryExpr)
		: ASTNode(ASTNode::cast_expression)
		, m_bIsUnaryExpr(true)
		, m_pUnaryExpr(pUnaryExpr){};
	CastExpr(sym *pTypeName, CastExpr *pCastExpr)
		: ASTNode(ASTNode::cast_expression)
		, m_bIsUnaryExpr(false)
		, m_pTypeName(pTypeName)
		, m_pCastExpr(pCastExpr){};

	virtual ~CastExpr(void);

	virtual	void				codeGen();

protected:
	bool				m_bIsUnaryExpr;
	union{
		UnaryExpr *		m_pUnaryExpr;
		struct{
			sym *		m_pTypeName;
			CastExpr *	m_pCastExpr;
		};
	};
};


#endif


